package com.home.webapp.monitor.service.impl;

import com.home.base.core.framework.msg.PageResponse;
import com.home.common.framework.core.service.impl.BaseServiceImpl;
import com.home.common.utils.query.QueryParams;
import com.home.webapp.monitor.entity.BaseOperLog;
import com.home.webapp.monitor.mapper.BaseOperLogMapper;
import com.home.webapp.monitor.service.BaseOperLogService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Description: 操作日志记录 serviceImpl
 * Created by 王大宸 on 2020-10-12 22:27:31
 * Created with IntelliJ IDEA.
 */
@Service
public class BaseOperLogServiceImpl extends BaseServiceImpl<BaseOperLogMapper, BaseOperLog, String> implements BaseOperLogService {
    private static final Logger logger = LoggerFactory.getLogger(BaseOperLogServiceImpl.class);

    /***
     * 功能说明：分页
     *
     * @author 王大宸
     * @date 2020/10/14 23:28
     * @param params
     * @return com.home.common.framework.msg.PageResponse
     */
    @Override
    public PageResponse<BaseOperLog> page(Map<String, Object> params) {
        QueryParams queryParams = new QueryParams(params);
        Page<BaseOperLog> page = PageHelper.startPage(queryParams.getPage(), queryParams.getLimit());
        List<BaseOperLog> list = baseMapper.page(queryParams);
        return PageResponse.ok(page.getTotal(), list);
    }
}
